//
//  HYOUStrategyCell.m
//  BestGift
//
//  Created by 温晓宇 on 15/12/31.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "HYOUStrategyCell.h"
#import "HYOUStrategyCollectionView.h"

@interface HYOUStrategyCell ()<HYOUStrategyCollectionViewDelegate>

@property(nonatomic, retain) HYOUStrategyCollectionView *collection;

@end

@implementation HYOUStrategyCell
-(void)dealloc{
    [_allArray release];
    [super dealloc];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews{
    
//    self.contentView.backgroundColor = RGBA(242, 242, 242, 1);
    
    self.collection = [[HYOUStrategyCollectionView alloc] initWithFrame:CGRectMake(0, 10, WIDTH, HEIGHT)];
//    self.collection.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.collection];
    
    self.collection.delegate = self;
}
-(void)showDetail:(NSString *)url{
    [self.delegate showDetail:url];
}
-(void)setAllArray:(NSMutableArray *)allArray{
    if (_allArray != allArray) {
        [_allArray release];
        _allArray = [allArray retain];
    }
    self.collection.frame = CGRectMake(0, 0, WIDTH, (self.allArray.count + 3) / 4 * 115 + 10);
    self.collection.allArray = self.allArray;
}
-(void)setName:(HYOUStrategyName *)name{
    if (_name != name) {
        [_name release];
        _name = [name retain];
    }
    self.collection.name = self.name;
}


@end
